package cn.melonlib.graphql.model.metadata;

import cn.melonlib.graphql.annos.GraphqlField;
import cn.melonlib.graphql.annos.GraphqlType;
import cn.melonlib.graphql.model.enums.GraphqlFunctionMode;
import cn.melonlib.graphql.model.enums.GraphqlQueryMode;
import lombok.Data;

import java.lang.reflect.Method;
import java.util.List;

/**
 * graphql执行方法
 */
@Data
@GraphqlType(namespaces = "GraphqlMetadata",comment = "graphql元数据接口函数描述")
public class GraphqlFunction {

    public GraphqlFunction() {
    }

    public GraphqlFunction(String name, String type,String comment, GraphqlFunctionMode mode,GraphqlQueryMode queryMode, List<GraphqlArgument> arguments,String bean,Method method) {
        this.name = name;
        this.type = type;
        this.comment=comment;
        this.mode = mode;
        this.queryMode=queryMode;
        this.arguments = arguments;
        this.bean=bean;
        this.method=method;
    }

    @GraphqlField(comment = "所属执行对象")
    private String bean;

    @GraphqlField(ignore = true)
    private Method method;

    @GraphqlField(comment = "查询类型")
    private GraphqlQueryMode queryMode;

    @GraphqlField(comment = "函数名称")
    private String name;

    @GraphqlField(comment = "返回类型")
    private String type;

    @GraphqlField(comment = "函数注释")
    private String comment;

    @GraphqlField(comment = "返回对象是否为列表")
    private boolean list;

    @GraphqlField(comment = "函数类型")
    private GraphqlFunctionMode mode;

    @GraphqlField(comment = "函数参数")
    private List<GraphqlArgument> arguments;


}
